<!DOCTYPE html>
<head>
    <title></title>
    #parse("sys/header.html")
</head>
<body>
    <div id="rrapp" v-cloak>
        <div v-show="showList">
            <Row :gutter="16">
                <div class="search-group">
                    <i-col span="4">
                        <i-input v-model="q.name" @on-enter="query" placeholder="名称"/>
                    </i-col>
                    <i-button @click="query">查询</i-button>
                </div>
                <div class="buttons-group">
                    #if($shiro.hasPermission("adsurvey:save"))
                    <i-button type="info" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</i-button>
                    #end
                    #if($shiro.hasPermission("adsurvey:update"))
                    <i-button type="warning" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</i-button>
                    #end
                    #if($shiro.hasPermission("adsurvey:delete"))
                    <i-button type="error" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</i-button>
                    #end
                </div>
            </Row>
            <table id="jqGrid"></table>
            <div id="jqGridPager"></div>
        </div>

        <Card v-show="!showList">
            <p slot="title">{{title}}</p>
            <i-form ref="formValidate" :model="adPosition" :rules="ruleValidate" :label-width="80">
                <Form-item label="调查表名称" prop="name">
                    <i-input v-model="adPosition.name" placeholder="位置名称"/>
                </Form-item>
                <Form-item label="调查表描述" prop="desc">
                    <i-input type="textarea" v-model="adPosition.desc" placeholder="描述"/>
                </Form-item>

                <Form-item label="宽度" prop="width">
                    <Input-number :min="0" :step="10" v-model="adPosition.width" placeholder="宽度" style="width: 188px;"/>
                </Form-item>
                <Form-item label="高度" prop="height">
                    <Input-number :min="0" :step="10" v-model="adPosition.height" placeholder="高度" style="width: 188px;"/>
                </Form-item>


                <FormItem
                        v-for="(item, index) in formDynamic.items"
                        v-if="item.status"
                        :key="index"
                        :label="'Item ' + item.index"
                        :prop="'items.' + index + '.value'"
                        :rules="{required: true, message: 'Item ' + item.index +' can not be empty', trigger: 'blur'}">
                    <Row>
                        <Col span="18">
                        <Input type="text" v-model="item.value" placeholder="请填写问题项"></Input>
                        </Col>
                        <Col span="4" offset="1">
                        <Button @click="handleRemove(index)">Delete</Button>
                        </Col>
                    </Row>
                </FormItem>
                <FormItem>
                    <Row>
                        <Col span="12">
                        <Button type="dashed" long @click="handleAdd" icon="md-add">Add item</Button>
                        </Col>
                    </Row>
                </FormItem>



                <Form-item>
                    <i-button type="primary" @click="handleSubmit('formValidate')">提交</i-button>
                    <i-button type="warning" @click="reload" style="margin-left: 8px"/>
                    返回</i-button>
                    <i-button type="ghost" @click="handleReset('formValidate')" style="margin-left: 8px">重置</i-button>
                </Form-item>
            </i-form>
        </Card>
    </div>
</body>
<script src="${rc.contextPath}/js/shop/survey.js?_${date.systemTime}"></script>
</html>